var App = function() {

    var setSuperSlide = function() {

        $("#flash1").slide({
            mainCell: ".bd ul",
            effect: "fold",
            autoPlay: true,
            titCell: ".auto",
            autoPage: "<li></li>",
            startFun: function(i, c, slider, titCell, mainCell, targetCell, prevCell, nextCell) {
                $("#flash1 .imgdesc-txt li").eq(i).animate({
                    "bottom": 0
                }).siblings().animate({
                    "bottom": -50
                });

            }
        });
        $("#flash2").slide({
            mainCell: ".bd ",
            autoPlay: false,
              effect: "left",
            // autoPage: "<li></li>,vis:3",

        });

    }

    var wow = function() {

        var $window = $(window),
            win_height_padded = $window.height() * 1.1;
            // isTouch = Modernizr.touch;
            //

        // if (isTouch) {
        //     $('.revealOnScroll').addClass('animated');
        // }

        $window.on('scroll', revealOnScroll);

        function revealOnScroll() {
            var scrolled = $window.scrollTop(),
                win_height_padded = $window.height() * 1.1;

            // Showed...
            $(".revealOnScroll:not(.animated)").each(function() {
                var $this = $(this),
                    offsetTop = $this.offset().top;

                if (scrolled + win_height_padded > offsetTop) {
                    if ($this.data('timeout')) {
                        window.setTimeout(function() {
                            $this.addClass('animated ' + $this.data('animation'));
                        }, parseInt($this.data('timeout'), 10));
                    } else {
                        $this.addClass('animated ' + $this.data('animation'));
                    }
                }
            });
            // Hidden...
            $(".revealOnScroll.animated").each(function(index) {
                var $this = $(this),
                    offsetTop = $this.offset().top;
                if (scrolled + win_height_padded < offsetTop) {
                    $(this).removeClass('animated fadeInUp fadeIn flipInX lightSpeedIn slide-market50')
                }
            });
        }
    }


    return {
        init: function() {
            setSuperSlide();
            wow();
        }
    }

}();
//加载init
$(function() {
    App.init();


})
